package com.gws.juc;

@FunctionalInterface
interface Foo{
	//public void sayHale();
	public int add(int x,int y);
	
	default int ride(int x,int y){
		return x * y;
	}
	
	public static int div(int x,int y){
		return x/y;
	}
}
/**
 * 使用lamda表达式
 * 拷贝小括号  写死右箭头  落地大括号
 * @param args
 */
public class LamdaExpressDemo02 {
	
	public static void main(String[] args) {
		/*Foo foo = new Foo() {
			@Override
			public void sayHale() {
				System.out.println("HelloWrold");
			}
		};
		foo.sayHale();*/
		
		/*Foo foo = () -> {System.out.println("HelloWrold");};
		foo.sayHale();*/
		
		Foo foo = (int x,int y) -> {
			return x+y;
		};
		System.out.println(foo.add(1, 3));
		
		System.out.println(foo.ride(2, 3));
		
		System.out.println(Foo.div(6, 3));
		
		
	}

}
